#include "../inc/utility.h"
#include <stdarg.h>
#include <stdio.h>
#include "../../mcc_generated_files/uart/usart0.h"

#if defined (__LOG_PRINT__)

#define BUFF_SIZE           100

void usart_write_buff(const uint8_t *data,uint8_t length)
{
    for(uint8_t i = 0u;i < length;i++)
    {
        while(!USART0_IsTxReady());
        
        USART0_Write(data[i]);
        
        while(!USART0_IsTxDone());
    }
}

void PRINTF(const char *fmt,...)
{
    uint8_t size = 0;
    va_list arg;
    char buff[BUFF_SIZE] = {0};
    va_start(arg,fmt);
    size = vsprintf(buff,fmt,arg);
    usart_write_buff((const uint8_t*)buff,size);

}

#endif









